
/*
global results = "C:\Users\andrkot\Dropbox (Frischsenteret)\Nasjonal data\results"
global data = "C:\Users\andrkot\Dropbox (Frischsenteret)\Nasjonal data"
*/



use  "$data\playdata.dta", clear

* Add times:
merge 1:1 responseid using "$data\tid+og+id.dta"
drop _m

gen double start_time = clock(interview_start, "YMDhms")
gen double end_time = clock(interview_end, "YMDhms")

format start_time %tc
format end_time %tc
list interview_start interview_end start_time end_time

gen time_diff_seconds = (end_time - start_time) / 1000

gen double time_diff_minutes = time_diff_seconds / 60

*** Keep variables used in the analysis and save as an anonymous file ***

keep poor_health age_groups T* list* any_p_* p_hits partner2020 crim_bike crim_house ph_dum* soc_des_raw very_high_sd high_inst_trust female  immigrant higher_edu disabled work  time_diff_minutes viol4 *_sd high_* new_*

compress
save "$data\replication_data_SMR.dta", replace 



* Variable creation:
tab age_groups, gen(age_dum)


gen t1_age_groups=list_treatment1*age_groups
gen t2_age_groups=list_treatment2*age_groups



gen T2_dh=T2_d
gen T2_dl=T2_d
gen T1_dh=T1_d
gen T1_dl=T1_d
gen T2_dht=T2_d
gen T2_dlt=T2_d
gen T1_dht=T1_d
gen T1_dlt=T1_d


tab poor_health
recode poor_health (1/2=1) (3/5=0), gen(good_health)

foreach var of varlist /// 
good_health female immigrant disabled work higher_edu ///
{
gen T2_dh`var'=T2_d
gen T2_dl`var'=T2_d
gen T1_dh`var'=T1_d
gen T1_dl`var'=T1_d
}
* Note age 3 cat:
gen T2_dha=T2_d
gen T2_dma=T2_d
gen T2_dla=T2_d
gen T1_dha=T1_d
gen T1_dma=T1_d
gen T1_dla=T1_d




************ Table 1 ***********

************ Descriptives ***********



* Descriptives:
local varlist /// 
any_p_psviol_2020 p_hits list1 list2 list_treatment1 list_treatment2 crim_bike crim_house ph_dum* age_dum1 age_dum2 age_dum3 soc_des_raw very_high_sd high_inst_trust female  immigrant higher_edu disabled work ///

cd "$results"
estpost summarize `varlist'  
est save "desk_all", replace
eststo all


local varlist /// 
any_p_psviol_2020 p_hits list1 list2 list_treatment1 list_treatment2 crim_bike crim_house ph_dum* age_dum1 age_dum2 age_dum3 soc_des_raw very_high_sd high_inst_trust female  immigrant higher_edu disabled work ///

cd "$results"
estpost summarize `varlist' if list_treatment1==1
est save "desk_all", replace
eststo l1


local varlist /// 
any_p_psviol_2020 p_hits list1 list2 list_treatment1 list_treatment2 crim_bike crim_house ph_dum* age_dum1 age_dum2 age_dum3 soc_des_raw very_high_sd high_inst_trust female  immigrant higher_edu disabled work ///

cd "$results"
estpost summarize `varlist' if list_treatment1==0
est save "desk_all", replace
eststo l2


* Text:
ttest any_p_psviol_2020, by(list_treatment1)

local varlist /// 
any_p_psviol_2020 p_hits list1 list2 list_treatment1 list_treatment2 crim_bike crim_house ph_dum* age_dum1 age_dum2 age_dum3 soc_des_raw very_high_sd high_inst_trust female  immigrant higher_edu disabled work ///



cd "$results"
#delimit;
esttab all l1 l2 using "desk_list.tex",
    style(tex) /*stats(N)*/  
    cells("mean (fmt(3) pattern(1 1 1 1 1 1)) sd (fmt(3) par pattern(1 1 1 1 1 1)) ") 
	mgroups(
		"All" "List 1" "List 2"
		, pattern(1 1 1) 
		prefix(\multicolumn{@span}{c}{) 
		suffix(}) 
		span 
		erepeat(\cmidrule(lr){@span})
	)
	order(`varlist')
    collabels(\multicolumn{1}{c}{Mean} \multicolumn{1}{c}{SD})
	varlabels(
	any_p_psviol_2020 "Any partner violence in 2020" 
	p_hits "Beaten by partner in 2020" 
	list1 "Number of items on list 1" 
	list2 "Number of items on list 2" 
	list_treatment1 "Treated list 1" 
	list_treatment2 "Treated list 2"  
	crim_bike "Household experienced a bike theft in 2020"
	crim_house "Someone broke into the respondents house in 2020"
	ph_dum1 "Health: Very good"
	ph_dum2 "Health: Good"
	ph_dum3 "Health: Neither good nor bad"
	ph_dum4 "Health: Bad"
	ph_dum5 "Health: Very bad"
	poor_health_d  "Individual had poor health in 2020 (dummy)"
	age_2020 "Age"
	age_dum1 "Age: Below 33 years" 
	age_dum2 "Age: 33-54 years" 
	age_dum3 "Age: Over 54 years"
	soc_des_raw "Social desirability score" 
	very_high_sd "Very high social desirability"
	high_inst_trust "High trust in institutions"
	female  "Female"
	immigrant "Immigrant"
	higher_edu "High education" 
	disabled "Disabled"
	work "Employed"
		,blist(any_p_psviol_2020 "\multicolumn{2}{l}{\emph{Partner violence}} \\" 
				list1 "\multicolumn{2}{l}{\emph{List experiment variables}} \\" 
				crim_bike "\multicolumn{2}{l}{\emph{Control variables}} \\"
	)
	)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
    replace;
#delimit cr

************ Table 2 ***********

* Panel A. Joint:
mean list1 list2, over(list_treatment1)
		lincom (_b[c.list1@1.list_treatment1]-_b[c.list1@0.list_treatment1] + _b[c.list2@0.list_treatment1]-_b[c.list2@1.list_treatment1])/2
		
mean list1 list2 if partner2020==1, over(list_treatment1)
		lincom (_b[c.list1@1.list_treatment1]-_b[c.list1@0.list_treatment1] + _b[c.list2@0.list_treatment1]-_b[c.list2@1.list_treatment1])/2		
	
*	Panel B

reg list1 list_treatment1, robust
 estadd local Controls "No"
 estadd local Sample "All"
 su list1 if e(sample)==1 &  list_treatment1==0
estadd scalar mean_depvar_c = r(mean)
eststo list_all
reg list1 list_treatment1 if partner2020==1, robust
 estadd local Controls "No"
 estadd local Sample "All partnered"
 su list1 if e(sample)==1 &  list_treatment1==0
estadd scalar mean_depvar_c = r(mean)
eststo list_partner2020



					local varlist ///
list_treatment1  ///
 
cd "$results"
#delimit;
	noisily esttab list_all list_partner2020 
		using "List1_nc.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample Controls, labels("Control mean" "N" "R-squared" "Sample" "Controls")  fmt(2 0 3 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("List 1" "List 1" )
		keep(`varlist') order(`varlist')
		varlabels(
	list_treatment1 "List Treatment"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr	
	

reg list2 list_treatment2, robust
 estadd local Controls "No"
 estadd local Sample "All"
 su list2 if e(sample)==1 &  list_treatment2==0
estadd scalar mean_depvar_c = r(mean)
eststo list_all
reg list2 list_treatment2 if partner2020==1, robust
 estadd local Controls "No"
 estadd local Sample "All partnered"
 su list2 if e(sample)==1 &  list_treatment2==0
estadd scalar mean_depvar_c = r(mean)
eststo list_partner2020


					local varlist ///
list_treatment2  ///
 
cd "$results"
#delimit;
	noisily esttab list_all list_partner2020 
		using "List2_nc.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample Controls, labels("Control mean" "N" "R-squared" "Sample" "Controls")  fmt(2 0 3 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("List 2" "List 2")
		keep(`varlist') order(`varlist')
		varlabels(
	list_treatment2 "List Treatment"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr	
	
	
************ Table 3 ***********
	
* Add controls: 

reg list1 list_treatment1 crim_bike if partner2020==1, robust
 estadd local Controls "List item"
 estadd local Sample "All partnered"
 su list1 if e(sample)==1 &  list_treatment1==0
estadd scalar mean_depvar_c = r(mean)
eststo list1_partner2020_c
reg list2 list_treatment2 i.poor_health crim_house if partner2020==1, robust
 estadd local Controls "List items"
 estadd local Sample "All partnered"
 su list2 if e(sample)==1 &  list_treatment2==0
estadd scalar mean_depvar_c = r(mean)
eststo list2_partner2020_c
reg list1 list_treatment1 crim_bike i.age_groups female i.poor_health crim_house immigrant higher_edu disabled work if partner2020==1, robust
 estadd local Controls "Extensive"
 estadd local Sample "All partnered"
 su list1 if e(sample)==1 &  list_treatment1==0
estadd scalar mean_depvar_c = r(mean)
eststo list1_partner2020_ce
reg list2 list_treatment2 crim_bike i.age_groups female i.poor_health crim_house immigrant higher_edu disabled work if partner2020==1, robust
 estadd local Controls "Extensive"
 estadd local Sample "All partnered"
 su list2 if e(sample)==1 &  list_treatment2==0
estadd scalar mean_depvar_c = r(mean)
eststo list2_partner2020_ce

					local varlist ///
list_treatment1 list_treatment2  ///
 
cd "$results"
#delimit;
	noisily esttab list1_partner2020_c list2_partner2020_c list1_partner2020_ce list2_partner2020_ce
		using "Lists_c.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample Controls, labels("Control mean" "N" "R-squared" "Sample" "Controls")  fmt(2 0 3 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("List 1" "List 2" "List 1" "List 2" )
		keep(`varlist') order(`varlist')
		varlabels(
	list_treatment1 "List Treatment 1"
	list_treatment2 "List Treatment 2"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr	

	
************ Table 4 ***********
	
bysort list_treatment1: tab list1 


bysort list_treatment2: tab list2

* Text: We get negative estimates even when we exclude those answering zero.
reg list1 list_treatment1 if partner2020==1, robust
reg list1 list_treatment1 if partner2020==1 & list1!=0, robust


reg list2 list_treatment2 if partner2020==1 & list2!=0, robust
reg list2 list_treatment2 if partner2020==1, robust

* Design effect etc in text.   

* Stata-test:
* 3 are lower than zero
kict deff list1 ,nnonkey(4) condition(list_treatment1) nogms
kict deff list2 if partner2020==1,nnonkey(4) condition(list_treatment2)
* 2 are lower than zero
kict deff list2 ,nnonkey(4) condition(list_treatment2) nogms
kict deff list2 if partner2020==1,nnonkey(4) condition(list_treatment2) nogms

* When either of these tests is statistically significant, researchers should conclude that the no-design-effect assumption does not hold.
	

************ Table 5 ***********


reg list1 list_treatment1 if any_p_psviol_2020==1, robust
reg list1 list_treatment1 if viol4==1, robust



************ Figure 1 ***********

set scheme s1mono

	reg new_l2 T2_d  if p_hits!=. & partner2020==1, robust
estimates store l2_diff
reg list2 list_treatment2 if p_hits!=. & partner2020==1, robust
estimates store l2_list
reg p_hits if e(sample)==1 & list_treatment2==0 & partner2020==1
estimates store l2_direct
reg p_hits if e(sample)==1 & list_treatment2==0 & partner2020==1
	
coefplot ///
    (l2_list, keep(list_treatment2) label(List)) ///
    (l2_direct, keep(_cons) label(Direct)) ///
    (l2_diff, keep(T2_d) label(Difference)), ///
    legend(off) ///
    title(List experiment 2) ///
    coeflabels(list_treatment2 = "List" _cons = "Direct" T2_d = "Difference", notick labsize(small)) ///
    yline(0) vertical ///
    order(_cons list_treatment2 T2_d) ///
    mlabel(@b ) format(%9.3f) mlabposition(10) mlabsize(small)
		gr save list2_all.gph, replace

		
		reg new_l1 T1_d if p_hits!=. & partner2020==1, robust
estimates store l1_diff
reg list1 list_treatment1 if p_hits!=. & partner2020==1, robust
estimates store l1_list
reg p_hits if e(sample)==1 & list_treatment1==0 & partner2020==1
estimates store l1_direct

coefplot ///
    (l1_list, keep(list_treatment1) label(List)) ///
    (l1_direct, keep(_cons) label(Direct)) ///
    (l1_diff, keep(T1_d) label(Difference)), ///
    legend(off) ///
    title(List experiment 1) ///
    coeflabels(list_treatment1 = "List" _cons = "Direct" T1_d = "Difference", notick labsize(small)) ///
    yline(0) vertical ///
    order(_cons list_treatment1 T1_d) ///
    mlabel(@b ) format(%9.3f) mlabposition(10) mlabsize(small)
		gr save list1_all.gph, replace
		

		
	  graph combine list1_all.gph list2_all.gph, title("") ycommon  graphregion(color(white))
		graph export "$results\lists_coeff.png", replace 
		

************ Figure 2 ***********

histogram soc_des_raw, frac discrete xtitle(Number of socially desirable traits)  xline(6)  fcolor(none) lcolor(black) graphregion(color(white))
 graph export "$results\soc_index.png", replace
  graph export "$results\soc_index.pdf", replace 

  
  ************ Figure 3 ***********

    set scheme s1mono
	cibar any_p_psviol_2020 if partner2020==1, over1(very_high_sd)  graphopts(ytitle("Any partner violence") xtitle("Social desirability score")   graphregion(color(white)) )  ///
bargap(5) 
graph export "$results\any_p_psviol_2020_vhsd.png", replace
graph export "$results\any_p_psviol_2020_vhsd.pdf", replace





  ************ Figure 4 ***********

  
* Heterogeneity:


reg new_l2 T2_dh  if p_hits!=. & partner2020==1 & very_high_sd==1, robust
estimates store l2_diff_hsd
reg new_l2 T2_dl  if p_hits!=. & partner2020==1 & very_high_sd==0, robust
estimates store l2_diff_1sd
reg new_l1 T1_dh  if p_hits!=. & partner2020==1 & very_high_sd==1, robust
estimates store l1_diff_hsd
reg new_l1 T1_dl  if p_hits!=. & partner2020==1 & very_high_sd==0, robust
estimates store l1_diff_1sd


reg new_l2 T2_dht  if p_hits!=. & partner2020==1 & high_inst_trust==1, robust
estimates store l2_diff_hit
reg new_l2 T2_dlt  if p_hits!=. & partner2020==1 & high_inst_trust==0, robust
estimates store l2_diff_1it
reg new_l1 T1_dht  if p_hits!=. & partner2020==1 & high_inst_trust==1, robust
estimates store l1_diff_hit
reg new_l1 T1_dlt  if p_hits!=. & partner2020==1 & high_inst_trust==0, robust
estimates store l1_diff_1it



reg new_l2 T2_dha  if p_hits!=. & partner2020==1 & age_dum3==1, robust
estimates store l2_diff_hsda1
reg new_l2 T2_dma  if p_hits!=. & partner2020==1 & age_dum2==1, robust
estimates store l2_diff_hsda2
reg new_l2 T2_dla  if p_hits!=. & partner2020==1 & age_dum1==1, robust
estimates store l2_diff_hsda3
reg new_l1 T1_dha  if p_hits!=. & partner2020==1 & age_dum3==1, robust
estimates store l1_diff_hsda1
reg new_l1 T1_dma  if p_hits!=. & partner2020==1 & age_dum2==1, robust
estimates store l1_diff_hsda2
reg new_l1 T1_dla  if p_hits!=. & partner2020==1 & age_dum1==1, robust
estimates store l1_diff_hsda3

foreach var of varlist /// 
good_health female immigrant disabled work higher_edu ///
{
reg new_l2 T2_dh`var'  if p_hits!=. & partner2020==1 & `var'==1, robust
estimates store l2_diff_h`var'
reg new_l2 T2_dl`var'  if p_hits!=. & partner2020==1 & `var'==0, robust
estimates store l2_diff_1`var'
reg new_l1 T1_dh`var'  if p_hits!=. & partner2020==1 & `var'==1, robust
estimates store l1_diff_h`var'
reg new_l1 T1_dl`var'  if p_hits!=. & partner2020==1 & `var'==0, robust
estimates store l1_diff_1`var'
}


coefplot  (l1_diff_hsd, keep(T1_dh))  (l1_diff_1sd, keep(T1_dl)) (l1_diff_hit, keep(T1_dht))  (l1_diff_1it, keep(T1_dlt)) (l1_diff_hsda1, keep(T1_dha))  (l1_diff_hsda2, keep(T1_dma)) (l1_diff_hsda3, keep(T1_dla)) (l1_diff_hgood_health, keep(T1_dhgood_health))  (l1_diff_1good_health, keep(T1_dlgood_health)) (l1_diff_hfemale, keep(T1_dhfemale))  (l1_diff_1female, keep(T1_dlfemale)) (l1_diff_himmigrant, keep(T1_dhimmigrant))  (l1_diff_1immigrant, keep(T1_dlimmigrant)) (l1_diff_hhigher_edu, keep(T1_dhhigher_edu))  (l1_diff_1higher_edu, keep(T1_dlhigher_edu)) ///
(l1_diff_hdisabled, keep(T1_dhdisabled))  (l1_diff_1disabled, keep(T1_dldisabled)) (l1_diff_hwork, keep(T1_dhwork))  (l1_diff_1work, keep(T1_dlwork)), ///
coeflabels(T1_dh = "Very high soc. dec" T1_dl = "Not very high soc. dec" T1_dht = "High trust" T1_dlt = "Low trust" T1_dha= "Over 54 years" T1_dma= "33-54 years" T1_dla = "Below 33 years" ///
T1_dhgood_health = "Good health" T1_dlgood_health = "Not good health"  T1_dhfemale = "Women" T1_dlfemale = "Men"  T1_dhimmigrant = "Immigrant" T1_dlimmigrant = "Native"  ///
T1_dhhigher_edu = "Higher education" T1_dlhigher_edu = "Not higher education"  T1_dhdisabled = "Disabled" T1_dldisabled = "Not disabled"  T1_dhwork = "Employed" T1_dlwork = "Not employed" , notick labsize(small))  xline(0) legend(off) title(List experiment 1)
		  graph save l1, replace


	
	coefplot  (l2_diff_hsd, keep(T2_dh))  (l2_diff_1sd, keep(T2_dl)) (l2_diff_hit, keep(T2_dht))  (l2_diff_1it, keep(T2_dlt)) (l2_diff_hsda1, keep(T2_dha))  (l2_diff_hsda2, keep(T2_dma)) (l2_diff_hsda3, keep(T2_dla)) (l2_diff_hgood_health, keep(T2_dhgood_health))  (l2_diff_1good_health, keep(T2_dlgood_health)) (l2_diff_hfemale, keep(T2_dhfemale))  (l2_diff_1female, keep(T2_dlfemale)) (l2_diff_himmigrant, keep(T2_dhimmigrant))  (l2_diff_1immigrant, keep(T2_dlimmigrant)) (l2_diff_hhigher_edu, keep(T2_dhhigher_edu))  (l2_diff_1higher_edu, keep(T2_dlhigher_edu)) ///
(l2_diff_hdisabled, keep(T2_dhdisabled))  (l2_diff_1disabled, keep(T2_dldisabled)) (l2_diff_hwork, keep(T2_dhwork))  (l2_diff_1work, keep(T2_dlwork)), ///
coeflabels(T2_dh = "Very high soc. dec" T2_dl = "Not very high soc. dec" T2_dht = "High trust" T2_dlt = "Low trust" T2_dha= "Over 54 years" T2_dma= "33-54 years" T2_dla = "Below 33 years" ///
T2_dhgood_health = "Good health" T2_dlgood_health = "Not good health"  T2_dhfemale = "Women" T2_dlfemale = "Men"  T2_dhimmigrant = "Immigrant" T2_dlimmigrant = "Native"  ///
T2_dhhigher_edu = "Higher education" T2_dlhigher_edu = "Not higher education"  T2_dhdisabled = "Disabled" T2_dldisabled = "Not disabled"  T2_dhwork = "Employed" T2_dlwork = "Not employed" , notick labsize(small))  xline(0) legend(off) title(List experiment 2)
	  graph save l2, replace

	  graph combine l1.gph l2.gph, title("") xcommon   graphregion(color(white))
		graph export "$results\hetero.png", replace 
		

		
		
************** Appendix: **************
*** Time use. Table A1

reg list1 list_treatment1 if partner2020==1 , robust
 estadd local Controls "No"
 estadd local Sample "All partnered"
 su list1 if e(sample)==1 &  list_treatment1==0
estadd scalar mean_depvar_c = r(mean)
eststo list_a_
reg list1 list_treatment1 if partner2020==1 & time_diff_minutes<10, robust
 estadd local Controls "No"
 estadd local Sample "Less than 10"
 su list1 if e(sample)==1 &  list_treatment1==0
estadd scalar mean_depvar_c = r(mean)
eststo list_10
reg list1 list_treatment1 if partner2020==1 & time_diff_minutes>10, robust
 estadd local Controls "No"
 estadd local Sample "More than 10"
 su list1 if e(sample)==1 &  list_treatment1==0
estadd scalar mean_depvar_c = r(mean)
eststo list_m10
reg list1 list_treatment1 if partner2020==1 & time_diff_minutes>20, robust
 estadd local Controls "No"
 estadd local Sample "More than 20"
 su list1 if e(sample)==1 &  list_treatment1==0
estadd scalar mean_depvar_c = r(mean)
eststo list_m20


	local varlist ///
    list_treatment1  ///

cd "$results"
esttab list_a_ list_10 list_m10 list_m20 ///
    using "time_1.rtf", ///
    stats(mean_depvar_c N r2 Sample Controls, ///
        labels("Control mean" "N" "R-squared" "Sample" "Controls") fmt(2 0 3 0)) ///
    starlevels(* 0.10 ** 0.05 *** 0.01) ///
    b(a2) se ///
    mtitles("List 1" "List 1" "List 1" "List 1") ///
    keep(`varlist') order(`varlist') ///
    varlabels(list_treatment1 "List Treatment") ///
    replace


	reg list2 list_treatment2 if partner2020==1 , robust
 estadd local Controls "No"
 estadd local Sample "All partnered"
 su list2 if e(sample)==1 &  list_treatment2==0
estadd scalar mean_depvar_c = r(mean)
eststo list_a
reg list2 list_treatment2 if partner2020==1 & time_diff_minutes<10, robust
 estadd local Controls "No"
 estadd local Sample "Less than 10"
 su list2 if e(sample)==1 &  list_treatment2==0
estadd scalar mean_depvar_c = r(mean)
eststo list_10
reg list2 list_treatment2 if partner2020==1 & time_diff_minutes>10, robust
 estadd local Controls "No"
 estadd local Sample "More than 10"
 su list2 if e(sample)==1 &  list_treatment2==0
estadd scalar mean_depvar_c = r(mean)
eststo list_m10
reg list2 list_treatment2 if partner2020==1 & time_diff_minutes>20, robust
 estadd local Controls "No"
 estadd local Sample "More than 20"
 su list2 if e(sample)==1 &  list_treatment2==0
estadd scalar mean_depvar_c = r(mean)
eststo list_m20


	local varlist ///
    list_treatment2  ///

cd "$results"
esttab list_a list_10 list_m10 list_m20 ///
    using "time_2.rtf", ///
    stats(mean_depvar_c N r2 Sample Controls, ///
        labels("Control mean" "N" "R-squared" "Sample" "Controls") fmt(2 0 3 0)) ///
    starlevels(* 0.10 ** 0.05 *** 0.01) ///
    b(a2) se ///
    mtitles("List 2" "List 2" "List 2" "List 2") ///
    keep(`varlist') order(`varlist') ///
    varlabels(list_treatment2 "List Treatment") ///
    replace

	* To text:
* Design test time use:
* 3 are lower than zero
kict deff list1 if partner2020==1 & time_diff_minutes>=20,nnonkey(4) condition(list_treatment1)
* 2 are lower than zero
kict deff list2 if partner2020==1 & time_diff_minutes>=20,nnonkey(4) condition(list_treatment2)



***** SD: Figure B1
 forvalues v=1/10 {
reg new_l2 T2_d  if p_hits!=. & partner2020==1 & soc_des_raw>`v', robust
estimates store l2_diff_sd`v'
 }
  forvalues v=1/10 {
reg new_l1 T1_d  if p_hits!=. & partner2020==1 & soc_des_raw>`v', robust
estimates store l1_diff_sd`v'
su  soc_des_raw
 }

  coefplot  (l1_diff_sd1 )   (l1_diff_sd2) (l1_diff_sd3) (l1_diff_sd4) (l1_diff_sd5) (l1_diff_sd6) (l1_diff_sd7) (l1_diff_sd8) (l1_diff_sd9) (l1_diff_sd10)  ,  keep(T1_d) xline(0) legend(off) title(List experiment 1)  coeflabels(T1_d = "List experiment`=char(13)'`=char(10)' coefficient for soc.`=char(13)'`=char(10)' des. cutoff 1/10", notick labsize(small)) 
 		  graph save l1, replace 
	graph export	  "$results\hetero_SD1.png", replace 	   


		 coefplot  (l2_diff_sd1 ) (l2_diff_sd2) (l2_diff_sd3) (l2_diff_sd4) (l2_diff_sd5) (l2_diff_sd6) (l2_diff_sd7) (l2_diff_sd8) (l2_diff_sd9) (l2_diff_sd10)  ,  keep(T2_d) xline(0) legend(off) title(List experiment 2)  coeflabels(T2_d = "List experiment`=char(13)'`=char(10)' coefficient for soc.`=char(13)'`=char(10)' des. cutoff 1/10", notick labsize(small)) 
 		  graph save l2, replace
		  
	graph export	  "$results\hetero_SD2.png", replace 	 
	
	
